/* Modernizr 2.6.2 (Custom Build) | MIT & BSD * Build: http://modernizr.com/download/#-inlinesvg-svg-svgclippaths-touch-shiv-mq-cssclasses-teststyles-prefixes-ie8compat-load */ ;window.Modernizr=function(a,b,c){function y(a){j.cssText=a}function z(a,b){return y(m.join(a+";")+(b||""))}function A(a,b){return typeof a===b}function B(a,b){return!!~(""+a).indexOf(b)}function C(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:A(f,"function")?f.bind(d||b):f}return!1}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={svg:"http://www.w3.org/2000/svg"},o={},p={},q={},r=[],s=r.slice,t,u=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},v=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return u("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},w={}.hasOwnProperty,x;!A(w,"undefined")&&!A(w.call,"undefined")?x=function(a,b){return w.call(a,b)}:x=function(a,b){return b in a&&A(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=s.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(s.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(s.call(arguments)))};return e}),o.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:u(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},o.svg=function(){return!!b.createElementNS&&!!b.createElementNS(n.svg,"svg").createSVGRect},o.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="",(a.firstChild&&a.firstChild.namespaceURI)==n.svg},o.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(l.call(b.createElementNS(n.svg,"clipPath")))};for(var D in o)x(o,D)&&(t=D.toLowerCase(),e[t]=o[D](),r.push((e[t]?"":"no-")+t));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)x(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},y(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e.mq=v,e.testStyles=u,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+r.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f fakeBody = doc.createElement( "body" ), div = doc.createElement( "div" ); div.id = "mq-test-1"; div.style.cssText = "position:absolute;top:-100em"; fakeBody.style.background = "none"; fakeBody.appendChild(div); return function(q){ div.innerHTML = "­"; docElem.insertBefore( fakeBody, refNode ); bool = div.offsetWidth === 42; docElem.removeChild( fakeBody ); return { matches: bool, media: q }; }; }( document )); // add dusty browser stuff if (!Array.prototype.filter) { Array.prototype.filter = function(fun /*, thisp */) { "use strict"; if (this == null) { throw new TypeError(); } var t = Object(this), len = t.length >>> 0; if (typeof fun !== "function") { return; } var res = [], thisp = arguments[1]; for (var i = 0; i < len; i++) { if (i in t) { var val = t[i]; // in case fun mutates this if (fun && fun.call(thisp, val, i, t)) { res.push(val); } } } return res; } } if (!Function.prototype.bind) { Function.prototype.bind = function (oThis) { if (typeof this !== "function") { // closest thing possible to the ECMAScript 5 internal IsCallable function throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function () {}, fBound = function () { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) { "use strict"; if (this == null) { throw new TypeError(); } var t = Object(this); var len = t.length >>> 0; if (len === 0) { return -1; } var n = 0; if (arguments.length > 1) { n = Number(arguments[1]); if (n != n) { // shortcut for verifying if it's NaN n = 0; } else if (n != 0 && n != Infinity && n != -Infinity) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } } if (n >= len) { return -1; } var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0); for (; k < len; k++) { if (k in t && t[k] === searchElement) { return k; } } return -1; } } // fake stop() for zepto. $.fn.stop = $.fn.stop || function() { return this; }; window.Foundation = { name : 'Foundation', version : '4.2.2', cache : {}, init : function (scope, libraries, method, options, response, /* internal */ nc) { var library_arr, args = [scope, method, options, response], responses = [], nc = nc || false; // disable library error catching, // used for development only if (nc) this.nc = nc; // check RTL this.rtl = /rtl/i.test($('html').attr('dir')); // set foundation global scope this.scope = scope || this.scope; if (libraries && typeof libraries === 'string' && !/reflow/i.test(libraries)) { if (/off/i.test(libraries)) return this.off(); library_arr = libraries.split(' '); if (library_arr.length > 0) { for (var i = library_arr.length - 1; i >= 0; i--) { responses.push(this.init_lib(library_arr[i], args)); } } } else { if (/reflow/i.test(libraries)) args[1] = 'reflow'; for (var lib in this.libs) { responses.push(this.init_lib(lib, args)); } } // if first argument is callback, add to args if (typeof libraries === 'function') { args.unshift(libraries); } return this.response_obj(responses, args); }, response_obj : function (response_arr, args) { for (var i = 0, len = args.length; i < len; i++) { if (typeof args[i] === 'function') { return args[i]({ errors: response_arr.filter(function (s) { if (typeof s === 'string') return s; }) }); } } return response_arr; }, init_lib : function (lib, args) { return this.trap(function () { if (this.libs.hasOwnProperty(lib)) { this.patch(this.libs[lib]); return this.libs[lib].init.apply(this.libs[lib], args); } else { return function () {}; } }.bind(this), lib); }, trap : function (fun, lib) { if (!this.nc) { try { return fun(); } catch (e) { return this.error({name: lib, message: 'could not be initialized', more: e.name + ' ' + e.message}); } } return fun(); }, patch : function (lib) { this.fix_outer(lib); lib.scope = this.scope; lib.rtl = this.rtl; }, inherit : function (scope, methods) { var methods_arr = methods.split(' '); for (var i = methods_arr.length - 1; i >= 0; i--) { if (this.lib_methods.hasOwnProperty(methods_arr[i])) { this.libs[scope.name][methods_arr[i]] = this.lib_methods[methods_arr[i]]; } } }, random_str : function (length) { var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split(''); if (!length) { length = Math.floor(Math.random() * chars.length); } var str = ''; for (var i = 0; i < length; i++) { str += chars[Math.floor(Math.random() * chars.length)]; } return str; }, libs : {}, // methods that can be inherited in libraries lib_methods : { set_data : function (node, data) { // this.name references the name of the library calling this method var id = [this.name,+new Date(),Foundation.random_str(5)].join('-'); Foundation.cache[id] = data; node.attr('data-' + this.name + '-id', id); return data; }, get_data : function (node) { return Foundation.cache[node.attr('data-' + this.name + '-id')]; }, remove_data : function (node) { if (node) { delete Foundation.cache[node.attr('data-' + this.name + '-id')]; node.attr('data-' + this.name + '-id', ''); } else { $('[data-' + this.name + '-id]').each(function () { delete Foundation.cache[$(this).attr('data-' + this.name + '-id')]; $(this).attr('data-' + this.name + '-id', ''); }); } }, throttle : function(fun, delay) { var timer = null; return function () { var context = this, args = arguments; clearTimeout(timer); timer = setTimeout(function () { fun.apply(context, args); }, delay); }; }, // parses data-options attribute on nodes and turns // them into an object data_options : function (el) { var opts = {}, ii, p, opts_arr = (el.attr('data-options') || ':').split(';'), opts_len = opts_arr.length; function isNumber (o) { return ! isNaN (o-0) && o !== null && o !== "" && o !== false && o !== true; } function trim(str) { if (typeof str === 'string') return $.trim(str); return str; } // parse options for (ii = opts_len - 1; ii >= 0; ii--) { p = opts_arr[ii].split(':'); if (/true/i.test(p[1])) p[1] = true; if (/false/i.test(p[1])) p[1] = false; if (isNumber(p[1])) p[1] = parseInt(p[1], 10); if (p.length === 2 && p[0].length > 0) { opts[trim(p[0])] = trim(p[1]); } } return opts; }, delay : function (fun, delay) { return setTimeout(fun, delay); }, // animated scrolling scrollTo : function (el, to, duration) { if (duration < 0) return; var difference = to - $(window).scrollTop(); var perTick = difference / duration * 10; this.scrollToTimerCache = setTimeout(function() { if (!isNaN(parseInt(perTick, 10))) { window.scrollTo(0, $(window).scrollTop() + perTick); this.scrollTo(el, to, duration - 10); } }.bind(this), 10); }, // not supported in core Zepto scrollLeft : function (el) { if (!el.length) return; return ('scrollLeft' in el[0]) ? el[0].scrollLeft : el[0].pageXOffset; }, // test for empty object or array empty : function (obj) { if (obj.length && obj.length > 0) return false; if (obj.length && obj.length === 0) return true; for (var key in obj) { if (hasOwnProperty.call(obj, key)) return false; } return true; } }, fix_outer : function (lib) { lib.outerHeight = function (el, bool) { if (typeof Zepto === 'function') { return el.height(); } if (typeof bool !== 'undefined') { return el.outerHeight(bool); } return el.outerHeight(); }; lib.outerWidth = function (el) { if (typeof Zepto === 'function') { return el.width(); } if (typeof bool !== 'undefined') { return el.outerWidth(bool); } return el.outerWidth(); }; }, error : function (error) { return error.name + ' ' + error.message + '; ' + error.more; }, // remove all foundation events. off: function () { $(this.scope).off('.fndtn'); $(window).off('.fndtn'); return true; }, zj : function () { if (typeof Zepto !== 'undefined') { return Zepto; } else { return jQuery; } }() }; $.fn.foundation = function () { var args = Array.prototype.slice.call(arguments, 0); return this.each(function () { Foundation.init.apply(Foundation, [this].concat(args)); return this; }); }; }(libFuncName, this, this.document)); ; /*jslint unparam: true, browser: true, indent: 2 */ ;(function ($, window, document, undefined) { 'use strict'; Foundation.libs.alerts = { name : 'alerts', version : '4.2.2', settings : { speed: 300, // fade out speed callback: function (){} }, init : function (scope, method, options) { this.scope = scope || this.scope; if (typeof method === 'object') { $.extend(true, this.settings, method); } if (typeof method !== 'string') { if (!this.settings.init) { this.events(); } return this.settings.init; } else { return this[method].call(this, options); } }, events : function () { var self = this; $(this.scope).on('click.fndtn.alerts', '[data-alert] a.close', function (e) { e.preventDefault(); $(this).closest("[data-alert]").fadeOut(self.speed, function () { $(this).remove(); self.settings.callback(); }); }); this.settings.init = true; }, off : function () { $(this.scope).off('.fndtn.alerts'); }, reflow : function () {} }; }(Foundation.zj, this, this.document));; /*jslint unparam: true, browser: true, indent: 2 */ ;(function ($, window, document, undefined) { 'use strict'; Foundation.libs.dropdown = { name : 'dropdown', version : '4.2.0', settings : { activeClass: 'open', is_hover: false, opened: function(){}, closed: function(){} }, init : function (scope, method, options) { this.scope = scope || this.scope; Foundation.inherit(this, 'throttle scrollLeft data_options'); if (typeof method === 'object') { $.extend(true, this.settings, method); } if (typeof method !== 'string') { if (!this.settings.init) { this.events(); } return this.settings.init; } else { return this[method].call(this, options); } }, events : function () { var self = this; $(this.scope) .on('click.fndtn.dropdown', '[data-dropdown]', function (e) { var settings = $.extend({}, self.settings, self.data_options($(this))); e.preventDefault(); if (!settings.is_hover) self.toggle($(this)); }) .on('mouseenter', '[data-dropdown]', function (e) { var settings = $.extend({}, self.settings, self.data_options($(this))); if (settings.is_hover) self.toggle($(this)); }) .on('mouseleave', '[data-dropdown-content]', function (e) { var target = $('[data-dropdown="' + $(this).attr('id') + '"]'), settings = $.extend({}, self.settings, self.data_options(target)); if (settings.is_hover) self.close.call(self, $(this)); }) .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened) .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed); $('body').on('click.fndtn.dropdown', function (e) { var parent = $(e.target).closest('[data-dropdown-content]'); if ($(e.target).data('dropdown')) { return; } if (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') || $.contains(parent.first()[0], e.target))) { e.stopPropagation(); return; } self.close.call(self, $('[data-dropdown-content]')); }); $(window).on('resize.fndtn.dropdown', self.throttle(function () { self.resize.call(self); }, 50)).trigger('resize'); this.settings.init = true; }, close: function (dropdown) { var self = this; dropdown.each(function () { if ($(this).hasClass(self.settings.activeClass)) { $(this) .css(Foundation.rtl ? 'right':'left', '-99999px') .removeClass(self.settings.activeClass); $(this).trigger('closed'); } }); }, open: function (dropdown, target) { this .css(dropdown .addClass(this.settings.activeClass), target); dropdown.trigger('opened'); }, toggle : function (target) { var dropdown = $('#' + target.data('dropdown')); this.close.call(this, $('[data-dropdown-content]').not(dropdown)); if (dropdown.hasClass(this.settings.activeClass)) { this.close.call(this, dropdown); } else { this.close.call(this, $('[data-dropdown-content]')) this.open.call(this, dropdown, target); } }, resize : function () { var dropdown = $('[data-dropdown-content].open'), target = $("[data-dropdown='" + dropdown.attr('id') + "']"); if (dropdown.length && target.length) { this.css(dropdown, target); } }, css : function (dropdown, target) { var offset_parent = dropdown.offsetParent(); // temporary workaround until 4.2 if (offset_parent.length > 0 && /body/i.test(dropdown.offsetParent()[0].nodeName)) { var position = target.offset(); position.top -= dropdown.offsetParent().offset().top; position.left -= dropdown.offsetParent().offset().left; } else { var position = target.position(); } if (this.small()) { dropdown.css({ position : 'absolute', width: '95%', left: '2.5%', 'max-width': 'none', top: position.top + this.outerHeight(target) }); } else { if (!Foundation.rtl && $(window).width() > this.outerWidth(dropdown) + target.offset().left) { var left = position.left; if (dropdown.hasClass('right')) { dropdown.removeClass('right'); } } else { if (!dropdown.hasClass('right')) { dropdown.addClass('right'); } var left = position.left - (this.outerWidth(dropdown) - this.outerWidth(target)); } dropdown.attr('style', '').css({ position : 'absolute', top: position.top + this.outerHeight(target), left: left }); } return dropdown; }, small : function () { return $(window).width() < 768 || $('html').hasClass('lt-ie9'); }, off: function () { $(this.scope).off('.fndtn.dropdown'); $('html, body').off('.fndtn.dropdown'); $(window).off('.fndtn.dropdown'); $('[data-dropdown-content]').off('.fndtn.dropdown'); this.settings.init = false; }, reflow : function () {} }; }(Foundation.zj, this, this.document)); ; ;(function ($, window, document, undefined) { 'use strict'; Foundation.libs = Foundation.libs || {}; Foundation.libs.orbit = { name: 'orbit', version: '4.2.0', settings: { timer_speed: 10000, pause_on_hover: true, resume_on_mouseout: false, animation_speed: 500, bullets: true, stack_on_small: true, navigation_arrows: true, slide_number: true, container_class: 'orbit-container', stack_on_small_class: 'orbit-stack-on-small', next_class: 'orbit-next', prev_class: 'orbit-prev', timer_container_class: 'orbit-timer', timer_paused_class: 'paused', timer_progress_class: 'orbit-progress', slides_container_class: 'orbit-slides-container', bullets_container_class: 'orbit-bullets', bullets_active_class: 'active', slide_number_class: 'orbit-slide-number', caption_class: 'orbit-caption', active_slide_class: 'active', orbit_transition_class: 'orbit-transitioning' }, init: function (scope, method, options) { var self = this; Foundation.inherit(self, 'data_options'); if (typeof method === 'object') { $.extend(true, self.settings, method); } if ($(scope).is('[data-orbit]')) { var scoped_self = $.extend(true, {}, self); scoped_self._init(idx, el); } $('[data-orbit]', scope).each(function(idx, el) { var scoped_self = $.extend(true, {}, self); scoped_self._init(idx, el); }); }, _container_html: function() { var self = this; return '
'; }, _bullets_container_html: function($slides) { var self = this, $list = $('
    '); $slides.each(function(idx, slide) { var $item = $('
  1. '); if (idx === 0) { $item.addClass(self.settings.bullets_active_class); } $list.append($item); }); return $list; }, _slide_number_html: function(slide_number, total_slides) { var self = this, $container = $('
    '); $container.append('' + slide_number + ' of ' + total_slides + ''); return $container; }, _timer_html: function() { var self = this; if (typeof self.settings.timer_speed === 'number' && self.settings.timer_speed > 0) { return '
    '; } else { return ''; } }, _next_html: function() { var self = this; return 'Next '; }, _prev_html: function() { var self = this; return 'Prev '; }, _init: function (idx, slider) { var self = this, $slides_container = $(slider), $container = $slides_container.wrap(self._container_html()).parent(), $slides = $slides_container.children(); $.extend(true, self.settings, self.data_options($slides_container)); if (self.settings.navigation_arrows) { $container.append(self._prev_html()); $container.append(self._next_html()); } $slides_container.addClass(self.settings.slides_container_class); if (self.settings.stack_on_small) { $container.addClass(self.settings.stack_on_small_class); } if (self.settings.slide_number) { $container.append(self._slide_number_html(1, $slides.length)); } $container.append(self._timer_html()); if (self.settings.bullets) { $container.after(self._bullets_container_html($slides)); } // To better support the "sliding" effect it's easier // if we just clone the first and last slides $slides_container.append($slides.first().clone().attr('data-orbit-slide','')); $slides_container.prepend($slides.last().clone().attr('data-orbit-slide','')); // Make the first "real" slide active $slides_container.css(Foundation.rtl ? 'marginRight' : 'marginLeft', '-100%'); $slides.first().addClass(self.settings.active_slide_class); self._init_events($slides_container); self._init_dimensions($slides_container); self._start_timer($slides_container); }, _init_events: function ($slides_container) { var self = this, $container = $slides_container.parent(); $(window) .on('load.fndtn.orbit', function() { $slides_container.height(''); $slides_container.height($slides_container.height($container.height())); $slides_container.trigger('orbit:ready'); }) .on('resize.fndtn.orbit', function() { $slides_container.height(''); $slides_container.height($slides_container.height($container.height())); }); $(document).on('click.fndtn.orbit', '[data-orbit-link]', function(e) { e.preventDefault(); var id = $(e.currentTarget).attr('data-orbit-link'), $slide = $slides_container.find('[data-orbit-slide=' + id + ']').first(); if ($slide.length === 1) { self._reset_timer($slides_container, true); self._goto($slides_container, $slide.index(), function() {}); } }); $container.siblings('.' + self.settings.bullets_container_class) .on('click.fndtn.orbit', '[data-orbit-slide-number]', function(e) { e.preventDefault(); self._reset_timer($slides_container, true); self._goto($slides_container, $(e.currentTarget).data('orbit-slide-number'),function() {}); }); $container .on('mouseenter.fndtn.orbit', function(e) { if (self.settings.pause_on_hover) { self._stop_timer($slides_container); } }) .on('mouseleave.fndtn.orbit', function(e) { if (self.settings.resume_on_mouseout) { self._start_timer($slides_container); } }) .on('orbit:after-slide-change.fndtn.orbit', function(e, orbit) { var $slide_number = $container.find('.' + self.settings.slide_number_class); if ($slide_number.length === 1) { $slide_number.replaceWith(self._slide_number_html(orbit.slide_number, orbit.total_slides)); } }) .on('orbit:next-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.next_class.split(" ").join("."), function(e) { e.preventDefault(); self._reset_timer($slides_container, true); self._goto($slides_container, 'next', function() {}); }) .on('orbit:prev-slide.fndtn.orbit click.fndtn.orbit', '.' + self.settings.prev_class.split(" ").join("."), function(e) { e.preventDefault(); self._reset_timer($slides_container, true); self._goto($slides_container, 'prev', function() {}); }) .on('orbit:toggle-play-pause.fndtn.orbit click.fndtn.orbit touchstart.fndtn.orbit', '.' + self.settings.timer_container_class, function(e) { e.preventDefault(); var $timer = $(e.currentTarget).toggleClass(self.settings.timer_paused_class), $slides_container = $timer.closest('.' + self.settings.container_class) .find('.' + self.settings.slides_container_class); if ($timer.hasClass(self.settings.timer_paused_class)) { self._stop_timer($slides_container); } else { self._start_timer($slides_container); } }) .on('touchstart.fndtn.orbit', function(e) { if (!e.touches) { e = e.originalEvent; } var data = { start_page_x: e.touches[0].pageX, start_page_y: e.touches[0].pageY, start_time: (new Date()).getTime(), delta_x: 0, is_scrolling: undefined }; $container.data('swipe-transition', data); e.stopPropagation(); }) .on('touchmove.fndtn.orbit', function(e) { if (!e.touches) { e = e.originalEvent; } // Ignore pinch/zoom events if(e.touches.length > 1 || e.scale && e.scale !== 1) return; var data = $container.data('swipe-transition'); if (typeof data === 'undefined') { data = {}; } data.delta_x = e.touches[0].pageX - data.start_page_x; if ( typeof data.is_scrolling === 'undefined') { data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) ); } if (!data.is_scrolling && !data.active) { e.preventDefault(); self._stop_timer($slides_container); var direction = (data.delta_x < 0) ? 'next' : 'prev'; data.active = true; self._goto($slides_container, direction, function() {}); } }) .on('touchend.fndtn.orbit', function(e) { $container.data('swipe-transition', {}); e.stopPropagation(); }); }, _init_dimensions: function ($slides_container) { var $container = $slides_container.parent(), $slides = $slides_container.children(); $slides_container.css('width', $slides.length * 100 + '%'); $slides.css('width', 100 / $slides.length + '%'); $slides_container.height($container.height()); $slides_container.css('width', $slides.length * 100 + '%'); }, _start_timer: function ($slides_container) { var self = this, $container = $slides_container.parent(); var callback = function() { self._reset_timer($slides_container, false); self._goto($slides_container, 'next', function() { self._start_timer($slides_container); }); }; var $timer = $container.find('.' + self.settings.timer_container_class), $progress = $timer.find('.' + self.settings.timer_progress_class), progress_pct = ($progress.width() / $timer.width()), delay = self.settings.timer_speed - (progress_pct * self.settings.timer_speed); $progress.animate({'width': '100%'}, delay, 'linear', callback); $slides_container.trigger('orbit:timer-started'); }, _stop_timer: function ($slides_container) { var self = this, $container = $slides_container.parent(), $timer = $container.find('.' + self.settings.timer_container_class), $progress = $timer.find('.' + self.settings.timer_progress_class), progress_pct = $progress.width() / $timer.width(); self._rebuild_timer($container, progress_pct * 100 + '%'); // $progress.stop(); $slides_container.trigger('orbit:timer-stopped'); $timer = $container.find('.' + self.settings.timer_container_class); $timer.addClass(self.settings.timer_paused_class); }, _reset_timer: function($slides_container, is_paused) { var self = this, $container = $slides_container.parent(); self._rebuild_timer($container, '0%'); if (typeof is_paused === 'boolean' && is_paused) { var $timer = $container.find('.' + self.settings.timer_container_class); $timer.addClass(self.settings.timer_paused_class); } }, _rebuild_timer: function ($container, width_pct) { // Zepto is unable to stop animations since they // are css-based. This is a workaround for that // limitation, which rebuilds the dom element // thus stopping the animation var self = this, $timer = $container.find('.' + self.settings.timer_container_class), $new_timer = $(self._timer_html()), $new_timer_progress = $new_timer.find('.' + self.settings.timer_progress_class); if (typeof Zepto === 'function') { $timer.remove(); $container.append($new_timer); $new_timer_progress.css('width', width_pct); } else if (typeof jQuery === 'function') { var $progress = $timer.find('.' + self.settings.timer_progress_class); $progress.css('width', width_pct); $progress.stop(); } }, _goto: function($slides_container, index_or_direction, callback) { var self = this, $container = $slides_container.parent(), $slides = $slides_container.children(), $active_slide = $slides_container.find('.' + self.settings.active_slide_class), active_index = $active_slide.index(), margin_position = Foundation.rtl ? 'marginRight' : 'marginLeft'; if ($container.hasClass(self.settings.orbit_transition_class)) { return false; } if (index_or_direction === 'prev') { if (active_index === 0) { active_index = $slides.length - 1; } else { active_index--; } } else if (index_or_direction === 'next') { active_index = (active_index+1) % $slides.length; } else if (typeof index_or_direction === 'number') { active_index = (index_or_direction % $slides.length); } if (active_index === ($slides.length - 1) && index_or_direction === 'next') { $slides_container.css(margin_position, '0%'); active_index = 1; } else if (active_index === 0 && index_or_direction === 'prev') { $slides_container.css(margin_position, '-' + ($slides.length - 1) * 100 + '%'); active_index = $slides.length - 2; } // Start transition, make next slide active $container.addClass(self.settings.orbit_transition_class); $active_slide.removeClass(self.settings.active_slide_class); $($slides[active_index]).addClass(self.settings.active_slide_class); // Make next bullet active var $bullets = $container.siblings('.' + self.settings.bullets_container_class); if ($bullets.length === 1) { $bullets.children().removeClass(self.settings.bullets_active_class); $($bullets.children()[active_index-1]).addClass(self.settings.bullets_active_class); } var new_margin_left = '-' + (active_index * 100) + '%'; // Check to see if animation will occur, otherwise perform // callbacks manually $slides_container.trigger('orbit:before-slide-change'); if ($slides_container.css(margin_position) === new_margin_left) { $container.removeClass(self.settings.orbit_transition_class); $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); callback(); } else { var properties = {}; properties[margin_position] = new_margin_left; $slides_container.animate(properties, self.settings.animation_speed, 'linear', function() { $container.removeClass(self.settings.orbit_transition_class); $slides_container.trigger('orbit:after-slide-change', [{slide_number: active_index, total_slides: $slides_container.children().length - 2}]); callback(); }); } } }; }(Foundation.zj, this, this.document)); ; /* * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ * * Uses the built in easing capabilities added In jQuery 1.1 * to offer multiple easing options * * TERMS OF USE - jQuery Easing * * Open source under the BSD License. * * Copyright © 2008 George McGinley Smith * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ // t: current time, b: begInnIng value, c: change In value, d: duration jQuery.easing['jswing'] = jQuery.easing['swing']; jQuery.extend( jQuery.easing, { def: 'easeOutQuad', swing: function (x, t, b, c, d) { //alert(jQuery.easing.default); return jQuery.easing[jQuery.easing.def](x, t, b, c, d); }, easeInQuad: function (x, t, b, c, d) { return c*(t/=d)*t + b; }, easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, easeInOutQuad: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t + b; return -c/2 * ((--t)*(t-2) - 1) + b; }, easeInCubic: function (x, t, b, c, d) { return c*(t/=d)*t*t + b; }, easeOutCubic: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t + 1) + b; }, easeInOutCubic: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t + b; return c/2*((t-=2)*t*t + 2) + b; }, easeInQuart: function (x, t, b, c, d) { return c*(t/=d)*t*t*t + b; }, easeOutQuart: function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }, easeInOutQuart: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t + b; return -c/2 * ((t-=2)*t*t*t - 2) + b; }, easeInQuint: function (x, t, b, c, d) { return c*(t/=d)*t*t*t*t + b; }, easeOutQuint: function (x, t, b, c, d) { return c*((t=t/d-1)*t*t*t*t + 1) + b; }, easeInOutQuint: function (x, t, b, c, d) { if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; return c/2*((t-=2)*t*t*t*t + 2) + b; }, easeInSine: function (x, t, b, c, d) { return -c * Math.cos(t/d * (Math.PI/2)) + c + b; }, easeOutSine: function (x, t, b, c, d) { return c * Math.sin(t/d * (Math.PI/2)) + b; }, easeInOutSine: function (x, t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }, easeInExpo: function (x, t, b, c, d) { return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; }, easeOutExpo: function (x, t, b, c, d) { return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; }, easeInOutExpo: function (x, t, b, c, d) { if (t==0) return b; if (t==d) return b+c; if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; }, easeInCirc: function (x, t, b, c, d) { return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; }, easeOutCirc: function (x, t, b, c, d) { return c * Math.sqrt(1 - (t=t/d-1)*t) + b; }, easeInOutCirc: function (x, t, b, c, d) { if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; }, easeInElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; }, easeOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; }, easeInOutElastic: function (x, t, b, c, d) { var s=1.70158;var p=0;var a=c; if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); if (a < Math.abs(c)) { a=c; var s=p/4; } else var s = p/(2*Math.PI) * Math.asin (c/a); if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; }, easeInBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*(t/=d)*t*((s+1)*t - s) + b; }, easeOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; }, easeInOutBack: function (x, t, b, c, d, s) { if (s == undefined) s = 1.70158; if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; }, easeInBounce: function (x, t, b, c, d) { return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b; }, easeOutBounce: function (x, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }, easeInOutBounce: function (x, t, b, c, d) { if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; } }); /* * * TERMS OF USE - EASING EQUATIONS * * Open source under the BSD License. * * Copyright © 2001 Robert Penner * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name of the author nor the names of contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * */ ; /*! * jQuery UI Widget @VERSION * http://jqueryui.com * * Copyright 2013 jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * * http://api.jqueryui.com/jQuery.widget/ */ (function( $, undefined ) { var uuid = 0, slice = Array.prototype.slice, _cleanData = $.cleanData; $.cleanData = function( elems ) { for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) { try { $( elem ).triggerHandler( "remove" ); // http://bugs.jquery.com/ticket/8235 } catch( e ) {} } _cleanData( elems ); }; $.widget = function( name, base, prototype ) { var fullName, existingConstructor, constructor, basePrototype, // proxiedPrototype allows the provided prototype to remain unmodified // so that it can be used as a mixin for multiple widgets (#8876) proxiedPrototype = {}, namespace = name.split( "." )[ 0 ]; name = name.split( "." )[ 1 ]; fullName = namespace + "-" + name; if ( !prototype ) { prototype = base; base = $.Widget; } // create selector for plugin $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { return !!$.data( elem, fullName ); }; $[ namespace ] = $[ namespace ] || {}; existingConstructor = $[ namespace ][ name ]; constructor = $[ namespace ][ name ] = function( options, element ) { // allow instantiation without "new" keyword if ( !this._createWidget ) { return new constructor( options, element ); } // allow instantiation without initializing for simple inheritance // must use "new" keyword (the code above always passes args) if ( arguments.length ) { this._createWidget( options, element ); } }; // extend with the existing constructor to carry over any static properties $.extend( constructor, existingConstructor, { version: prototype.version, // copy the object used to create the prototype in case we need to // redefine the widget later _proto: $.extend( {}, prototype ), // track widgets that inherit from this widget in case this widget is // redefined after a widget inherits from it _childConstructors: [] }); basePrototype = new base(); // we need to make the options hash a property directly on the new instance // otherwise we'll modify the options hash on the prototype that we're // inheriting from basePrototype.options = $.widget.extend( {}, basePrototype.options ); $.each( prototype, function( prop, value ) { if ( !$.isFunction( value ) ) { proxiedPrototype[ prop ] = value; return; } proxiedPrototype[ prop ] = (function() { var _super = function() { return base.prototype[ prop ].apply( this, arguments ); }, _superApply = function( args ) { return base.prototype[ prop ].apply( this, args ); }; return function() { var __super = this._super, __superApply = this._superApply, returnValue; this._super = _super; this._superApply = _superApply; returnValue = value.apply( this, arguments ); this._super = __super; this._superApply = __superApply; return returnValue; }; })(); }); constructor.prototype = $.widget.extend( basePrototype, { // TODO: remove support for widgetEventPrefix // always use the name + a colon as the prefix, e.g., draggable:start // don't prefix for widgets that aren't DOM-based widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name }, proxiedPrototype, { constructor: constructor, namespace: namespace, widgetName: name, widgetFullName: fullName }); // If this widget is being redefined then we need to find all widgets that // are inheriting from it and redefine all of them so that they inherit from // the new version of this widget. We're essentially trying to replace one // level in the prototype chain. if ( existingConstructor ) { $.each( existingConstructor._childConstructors, function( i, child ) { var childPrototype = child.prototype; // redefine the child widget using the same prototype that was // originally used, but inherit from the new version of the base $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); }); // remove the list of existing child constructors from the old constructor // so the old child constructors can be garbage collected delete existingConstructor._childConstructors; } else { base._childConstructors.push( constructor ); } $.widget.bridge( name, constructor ); return constructor; }; $.widget.extend = function( target ) { var input = slice.call( arguments, 1 ), inputIndex = 0, inputLength = input.length, key, value; for ( ; inputIndex < inputLength; inputIndex++ ) { for ( key in input[ inputIndex ] ) { value = input[ inputIndex ][ key ]; if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { // Clone objects if ( $.isPlainObject( value ) ) { target[ key ] = $.isPlainObject( target[ key ] ) ? $.widget.extend( {}, target[ key ], value ) : // Don't extend strings, arrays, etc. with objects $.widget.extend( {}, value ); // Copy everything else by reference } else { target[ key ] = value; } } } } return target; }; $.widget.bridge = function( name, object ) { var fullName = object.prototype.widgetFullName || name; $.fn[ name ] = function( options ) { var isMethodCall = typeof options === "string", args = slice.call( arguments, 1 ), returnValue = this; // allow multiple hashes to be passed on init options = !isMethodCall && args.length ? $.widget.extend.apply( null, [ options ].concat(args) ) : options; if ( isMethodCall ) { this.each(function() { var methodValue, instance = $.data( this, fullName ); if ( options === "instance" ) { returnValue = instance; return false; } if ( !instance ) { return $.error( "cannot call methods on " + name + " prior to initialization; " + "attempted to call method '" + options + "'" ); } if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { return $.error( "no such method '" + options + "' for " + name + " widget instance" ); } methodValue = instance[ options ].apply( instance, args ); if ( methodValue !== instance && methodValue !== undefined ) { returnValue = methodValue && methodValue.jquery ? returnValue.pushStack( methodValue.get() ) : methodValue; return false; } }); } else { this.each(function() { var instance = $.data( this, fullName ); if ( instance ) { instance.option( options || {} )._init(); } else { $.data( this, fullName, new object( options, this ) ); } }); } return returnValue; }; }; $.Widget = function( /* options, element */ ) {}; $.Widget._childConstructors = []; $.Widget.prototype = { widgetName: "widget", widgetEventPrefix: "", defaultElement: "
    ", options: { disabled: false, // callbacks create: null }, _createWidget: function( options, element ) { element = $( element || this.defaultElement || this )[ 0 ]; this.element = $( element ); this.uuid = uuid++; this.eventNamespace = "." + this.widgetName + this.uuid; this.options = $.widget.extend( {}, this.options, this._getCreateOptions(), options ); this.bindings = $(); this.hoverable = $(); this.focusable = $(); if ( element !== this ) { $.data( element, this.widgetFullName, this ); this._on( true, this.element, { remove: function( event ) { if ( event.target === element ) { this.destroy(); } } }); this.document = $( element.style ? // element within the document element.ownerDocument : // element is window or document element.document || element ); this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); } this._create(); this._trigger( "create", null, this._getCreateEventData() ); this._init(); }, _getCreateOptions: $.noop, _getCreateEventData: $.noop, _create: $.noop, _init: $.noop, destroy: function() { this._destroy(); // we can probably remove the unbind calls in 2.0 // all event bindings should go through this._on() this.element .unbind( this.eventNamespace ) .removeData( this.widgetFullName ) // support: jquery <1.6.3 // http://bugs.jquery.com/ticket/9413 .removeData( $.camelCase( this.widgetFullName ) ); this.widget() .unbind( this.eventNamespace ) .removeAttr( "aria-disabled" ) .removeClass( this.widgetFullName + "-disabled " + "ui-state-disabled" ); // clean up events and states this.bindings.unbind( this.eventNamespace ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); }, _destroy: $.noop, widget: function() { return this.element; }, option: function( key, value ) { var options = key, parts, curOption, i; if ( arguments.length === 0 ) { // don't return a reference to the internal hash return $.widget.extend( {}, this.options ); } if ( typeof key === "string" ) { // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } options = {}; parts = key.split( "." ); key = parts.shift(); if ( parts.length ) { curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); for ( i = 0; i < parts.length - 1; i++ ) { curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; curOption = curOption[ parts[ i ] ]; } key = parts.pop(); if ( value === undefined ) { return curOption[ key ] === undefined ? null : curOption[ key ]; } curOption[ key ] = value; } else { if ( value === undefined ) { return this.options[ key ] === undefined ? null : this.options[ key ]; } options[ key ] = value; } } this._setOptions( options ); return this; }, _setOptions: function( options ) { var key; for ( key in options ) { this._setOption( key, options[ key ] ); } return this; }, _setOption: function( key, value ) { this.options[ key ] = value; if ( key === "disabled" ) { this.widget() .toggleClass( this.widgetFullName + "-disabled", !!value ); this.hoverable.removeClass( "ui-state-hover" ); this.focusable.removeClass( "ui-state-focus" ); } return this; }, enable: function() { return this._setOptions({ disabled: false }); }, disable: function() { return this._setOptions({ disabled: true }); }, _on: function( suppressDisabledCheck, element, handlers ) { var delegateElement, instance = this; // no suppressDisabledCheck flag, shuffle arguments if ( typeof suppressDisabledCheck !== "boolean" ) { handlers = element; element = suppressDisabledCheck; suppressDisabledCheck = false; } // no element argument, shuffle and use this.element if ( !handlers ) { handlers = element; element = this.element; delegateElement = this.widget(); } else { // accept selectors, DOM elements element = delegateElement = $( element ); this.bindings = this.bindings.add( element ); } $.each( handlers, function( event, handler ) { function handlerProxy() { // allow widgets to customize the disabled handling // - disabled as an array instead of boolean // - disabled class as method for disabling individual parts if ( !suppressDisabledCheck && ( instance.options.disabled === true || $( this ).hasClass( "ui-state-disabled" ) ) ) { return; } return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } // copy the guid so direct unbinding works if ( typeof handler !== "string" ) { handlerProxy.guid = handler.guid = handler.guid || handlerProxy.guid || $.guid++; } var match = event.match( /^(\w+)\s*(.*)$/ ), eventName = match[1] + instance.eventNamespace, selector = match[2]; if ( selector ) { delegateElement.delegate( selector, eventName, handlerProxy ); } else { element.bind( eventName, handlerProxy ); } }); }, _off: function( element, eventName ) { eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace; element.unbind( eventName ).undelegate( eventName ); }, _delay: function( handler, delay ) { function handlerProxy() { return ( typeof handler === "string" ? instance[ handler ] : handler ) .apply( instance, arguments ); } var instance = this; return setTimeout( handlerProxy, delay || 0 ); }, _hoverable: function( element ) { this.hoverable = this.hoverable.add( element ); this._on( element, { mouseenter: function( event ) { $( event.currentTarget ).addClass( "ui-state-hover" ); }, mouseleave: function( event ) { $( event.currentTarget ).removeClass( "ui-state-hover" ); } }); }, _focusable: function( element ) { this.focusable = this.focusable.add( element ); this._on( element, { focusin: function( event ) { $( event.currentTarget ).addClass( "ui-state-focus" ); }, focusout: function( event ) { $( event.currentTarget ).removeClass( "ui-state-focus" ); } }); }, _trigger: function( type, event, data ) { var prop, orig, callback = this.options[ type ]; data = data || {}; event = $.Event( event ); event.type = ( type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type ).toLowerCase(); // the original event may come from any element // so we need to reset the target on the new event event.target = this.element[ 0 ]; // copy original event properties over to the new event orig = event.originalEvent; if ( orig ) { for ( prop in orig ) { if ( !( prop in event ) ) { event[ prop ] = orig[ prop ]; } } } this.element.trigger( event, data ); return !( $.isFunction( callback ) && callback.apply( this.element[0], [ event ].concat( data ) ) === false || event.isDefaultPrevented() ); } }; $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { if ( typeof options === "string" ) { options = { effect: options }; } var hasOptions, effectName = !options ? method : options === true || typeof options === "number" ? defaultEffect : options.effect || defaultEffect; options = options || {}; if ( typeof options === "number" ) { options = { duration: options }; } hasOptions = !$.isEmptyObject( options ); options.complete = callback; if ( options.delay ) { element.delay( options.delay ); } if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { element[ method ]( options ); } else if ( effectName !== method && element[ effectName ] ) { element[ effectName ]( options.duration, options.easing, callback ); } else { element.queue(function( next ) { $( this )[ method ](); if ( callback ) { callback.call( element[ 0 ] ); } next(); }); } }; }); })( jQuery ); ; /* * jQuery Mobile Framework : events * Copyright (c) jQuery Project * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license */ (function ($, undefined) { $.attrFn = $.attrFn || {}; // add new event shortcuts $.each("touchstart touchmove touchend orientationchange tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "), function (i, name) { $.fn[ name ] = function (fn) { return fn ? this.bind(name, fn) : this.trigger(name); }; $.attrFn[ name ] = true; }); var supportTouch = ('ontouchstart' in window), scrollEvent = "touchmove scroll", touchStartEvent = supportTouch ? "touchstart" : "mousedown", touchStopEvent = supportTouch ? "touchend" : "mouseup", touchMoveEvent = supportTouch ? "touchmove" : "mousemove"; // also handles scrollstop $.event.special.scrollstart = { enabled: true, setup: function () { var thisObject = this, $this = $(thisObject), scrolling, timer; function trigger(event, state) { scrolling = state; var originalType = event.type; event.type = scrolling ? "scrollstart" : "scrollstop"; $.event.handle.call(thisObject, event); event.type = originalType; } // iPhone triggers scroll after a small delay; use touchmove instead $this.bind(scrollEvent, function (event) { if (!$.event.special.scrollstart.enabled) { return; } if (!scrolling) { trigger(event, true); } clearTimeout(timer); timer = setTimeout(function () { trigger(event, false); }, 50); }); } }; // also handles taphold $.event.special.tap = { setup: function () { var thisObject = this, $this = $(thisObject); $this .bind(touchStartEvent, function (event) { if (event.which && event.which !== 1 || //check if event fired once already by a device that fires both mousedown and touchstart (while supporting both events) $this.data("prevEvent") && $this.data("prevEvent") !== event.type) { return false; } //save event type so only this type is let through for a temp duration, //allowing quick repetitive taps but not duplicative events $this.data("prevEvent", event.type); setTimeout(function () { $this.removeData("prevEvent"); }, 800); var moved = false, touching = true, origTarget = event.target, origEvent = event.originalEvent, origPos = event.type == "touchstart" ? [origEvent.touches[0].pageX, origEvent.touches[0].pageY] : [ event.pageX, event.pageY ], originalType, timer; function moveHandler(event) { if (event.type == "scroll") { moved = true; return; } var newPageXY = event.type == "touchmove" ? event.originalEvent.touches[0] : event; if ((Math.abs(origPos[0] - newPageXY.pageX) > 10) || (Math.abs(origPos[1] - newPageXY.pageY) > 10)) { moved = true; } } timer = setTimeout(function () { if (touching && !moved) { originalType = event.type; event.type = "taphold"; $.event.handle.call(thisObject, event); event.type = originalType; } }, 750); //scroll now cancels tap $(window).one("scroll", moveHandler); $this .bind(touchMoveEvent, moveHandler) .one(touchStopEvent, function (event) { $this.unbind(touchMoveEvent, moveHandler); $(window).unbind("scroll", moveHandler); clearTimeout(timer); touching = false; // ONLY trigger a 'tap' event if the start target is // the same as the stop target. if (!moved && ( origTarget == event.target )) { originalType = event.type; event.type = "tap"; $.event.handle.call(thisObject, event); event.type = originalType; } }); }); } }; // also handles swipeleft, swiperight $.event.special.swipe = { setup: function () { var thisObject = this, $this = $(thisObject); $this .bind(touchStartEvent, function (event) { var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event, start = { time: (new Date).getTime(), coords: [ data.pageX, data.pageY ], origin: $(event.target) }, stop; function moveHandler(event) { if (!start) { return; } var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event; stop = { time: (new Date).getTime(), coords: [ data.pageX, data.pageY ] }; // prevent scrolling if (Math.abs(start.coords[0] - stop.coords[0]) > 10) { event.preventDefault(); } } $this .bind(touchMoveEvent, moveHandler) .one(touchStopEvent, function (event) { $this.unbind(touchMoveEvent, moveHandler); if (start && stop) { if (stop.time - start.time < 1000 && Math.abs(start.coords[0] - stop.coords[0]) > 30 && Math.abs(start.coords[1] - stop.coords[1]) < 75) { start.origin .trigger("swipe") .trigger(start.coords[0] > stop.coords[0] ? "swipeleft" : "swiperight"); } } start = stop = undefined; }); }); } }; (function ($) { // "Cowboy" Ben Alman var win = $(window), special_event, get_orientation, last_orientation; $.event.special.orientationchange = special_event = { setup: function () { // If the event is supported natively, return false so that jQuery // will bind to the event using DOM methods. if ($.support.orientation) { return false; } // Get the current orientation to avoid initial double-triggering. last_orientation = get_orientation(); // Because the orientationchange event doesn't exist, simulate the // event by testing window dimensions on resize. win.bind("resize", handler); }, teardown: function () { // If the event is not supported natively, return false so that // jQuery will unbind the event using DOM methods. if ($.support.orientation) { return false; } // Because the orientationchange event doesn't exist, unbind the // resize event handler. win.unbind("resize", handler); }, add: function (handleObj) { // Save a reference to the bound event handler. var old_handler = handleObj.handler; handleObj.handler = function (event) { // Modify event object, adding the .orientation property. event.orientation = get_orientation(); // Call the originally-bound event handler and return its result. return old_handler.apply(this, arguments); }; } }; // If the event is not supported natively, this handler will be bound to // the window resize event to simulate the orientationchange event. function handler() { // Get the current orientation. var orientation = get_orientation(); if (orientation !== last_orientation) { // The orientation has changed, so trigger the orientationchange event. last_orientation = orientation; win.trigger("orientationchange"); } }; // Get the current page orientation. This method is exposed publicly, should it // be needed, as jQuery.event.special.orientationchange.orientation() special_event.orientation = get_orientation = function () { var elem = document.documentElement; return elem && elem.clientWidth / elem.clientHeight < 1.1 ? "portrait" : "landscape"; }; })(jQuery); $.each({ scrollstop: "scrollstart", taphold: "tap", swipeleft: "swipe", swiperight: "swipe" }, function (event, sourceEvent) { $.event.special[ event ] = { setup: function () { $(this).bind(sourceEvent, $.noop); } }; }); })(jQuery); ; (function ($, window) { // tracking for clicking on free video link to the player site $(document).ready(function() { // Trigger a Google Analytics _trackEvent for click events on elements with // the .ga-track-click-event class. Parameters for the event will be extracted // from data attributes on the element. $(document).on('click', '.ga-track-click-event', function(e) { if ($(this).data('event-category')) { var category = $(this).data('event-category'); } if ($(this).data('event-action')) { var action = $(this).data('event-action'); } if ($(this).data('event-label')) { var label = $(this).data('event-label'); } if ($(this).data('event-value')) { var value = $(this).data('event-value'); } _gaq.push(['_trackEvent', category, action, label, value, true]); }); $(document).on('click', '.mg-bfiplayer-video-tab .slide-caption a', function() { _gaq.push(['_trackEvent', 'BFI Player click-through', 'Click', 'free - player site', , true]); }); /** * Event tracking for header and footer. */ $(document).on('click', '.header a, .footer a', function(e) { var linkTitle = $(this).text(); var linkHref = $(this).attr('href'); var eventAction; var bounceRateCalculation = false; // If the link is just a hash (such as the text size links) then the event hit will not be used in bounce-rate calculation. if (linkHref == '#') { bounceRateCalculation = true; } if ($(this).is('.header a')) { eventAction = 'Header link click'; } else if ($(this).is('.footer a')) { eventAction = 'Footer link click'; } _gaq.push(['_trackEvent', 'Header/footer click-through', eventAction, linkTitle, , bounceRateCalculation]); }); }); /** * function that removes the css defined height of lazy-loaded images and placeholders, * to prevent 'stretching' on browser resize. */ window.flexImageFix = function() { $('img.lazy-loaded, img.lazy-hidden').each( function() { $(this).css('height', ''); }); }; window.fixIe8LastChild = function() { $('[class*="column"] + [class*="column"]:last').addClass('last-child'); $('.button-group :last-child, .bfig .thumbnails > li a:last-child, p:last-child, .screenings li:last-child, .pinned td:last-child').addClass('last-child'); }; window.bfiResize = function() { if (window.resizeStatus != 'inProgress'){ window.resizeStatus = 'inProgress'; $('#bfi-gallery').gallery('reset'); setTimeout("window.resizeStatus = 'done';", 500); flexImageFix(); $('body.with-hero-banner').heroBanner('resetBanner'); $('.equalise[class*=-block-grid-]').equalHeight('equalise', true); $('.twitter-feed:first').twitterFeed('reset'); //$('.layout-item :bfi-equalHeight').equalHeight('equalise'); /** --- Active Breakpoint Custom Event --- **/ // get the current breakpoint label from window object current_breakpoint = window.currentBreakpoint; // get the details for the active breakpoint new_breakpoint = getBreakpoint(); /** * check if label for the new breakpoint matches the old one. * if not, either a new breakpoint has been activated or the page has just been loaded * current_breakpoint on page load is undefined */ if(current_breakpoint != new_breakpoint.label) { // assign the active breakpoint label to a window property window.currentBreakpoint = new_breakpoint.label; // add / update the body class with current label if (typeof current_breakpoint === "undefined") { $( "body" ).addClass( new_breakpoint.label ); } else { $( "body" ).removeClass( current_breakpoint ).addClass( new_breakpoint.label ); } /** * trigger the change active breakpoint event, passing the lower, upper bounds and label properties * as arguments to the event listener */ $( document ).trigger({ type: "changeActiveBreakpoint", lower_bound: new_breakpoint.lower_bound, upper_bound: new_breakpoint.upper_bound, label: new_breakpoint.label }); } /** --- End Active Breakpoint Custom Event --- **/ } }; /** * this function gets the current active breakpoint, based on the available media queries * and current browser resolution and returns a set of properties related to it. * @return {object} breakpoint * Available properties: * - breakpoint.lower_bound - the lower bound from the current breakpoint * - breakpoint.upper_bound - the upper bound from the current breakpoint * - breakpoint.label - label assigned to the breakpoint (x-small, small, medium, large, x-large, xx-large) */ window.getBreakpoint = function() { var breakpoint = []; if (Modernizr.mq('only screen and (max-width: 320px)')) { breakpoint.lower_bound = 0; breakpoint.upper_bound = 320; breakpoint.label = 'x-small'; } if (Modernizr.mq('only screen and (min-width: 321px) and (max-width: 480px)')) { breakpoint.lower_bound = 321; breakpoint.upper_bound = 480; breakpoint.label = 'small'; } if (Modernizr.mq('only screen and (min-width: 481px) and (max-width: 767px)')) { breakpoint.lower_bound = 481; breakpoint.upper_bound = 767; breakpoint.label = 'medium'; } if (Modernizr.mq('only screen and (min-width: 768px) and (max-width: 1023px)')) { breakpoint.lower_bound = 768; breakpoint.upper_bound = 1023; breakpoint.label = 'large'; } if (Modernizr.mq('only screen and (min-width: 1024px) and (max-width: 1439px)')) { breakpoint.lower_bound = 1024; breakpoint.upper_bound = 1439; breakpoint.label = 'x-large'; } if (Modernizr.mq('only screen and (min-width: 1440px)')) { breakpoint.lower_bound = 1440; breakpoint.upper_bound = 999999; breakpoint.label = 'xx-large'; } return breakpoint; }; /* +++ equalHeight +++ */ $.widget('bfi.equalHeight', { options: { child: '> li .box', perRow: true }, _create: function() { var $element = this.element, so = this.options; for (var opt in so) { if ( (typeof $element.attr('data-' + opt) != 'undefined') && ((typeof options == 'undefined') || (typeof options[opt] == 'undefined')) ) so[opt] = $element.attr('data-' + opt); } }, equalise: function( resizing ) { if ( (resizing != true) && this.element.hasClass('equalised')) return; var so = this.options, maxH = 0, lastLeft = -9999, colCount = 0; var $collection = this.element.find( so.child ); $collection.css('min-height', 0); $collection.each( function() { if ( $(this).position().left > lastLeft) { lastLeft = $(this).position().left; colCount++; } else { return false; } }); if (colCount == 1) { this.element.addClass('equalised'); return; } $collection.each(function() {}) for (var i=0; i < Math.ceil($collection.length/colCount); i++) { var maxH = 0; for (var j=0; j < colCount; j++) { var item = $collection.get(i * colCount + j); $(item).addClass('equalising'); if ($(item).innerHeight() > maxH) { maxH = $(item).innerHeight(); } } $collection.filter('.equalising:not(.equalised)').css('min-height', maxH).removeClass('equalising').addClass('equalised'); }; this.element.addClass('equalised').find(so.child).removeClass('equalised'); } }); /* +++ foldable +++ * * Widget for a foldable list of items, currently used for: * - the cast & credits list on a work page. * - the filmography list on an agent page. * - the alternative titles list on a work page. * - the text in the MA-TEXT component (folding after the first paragraph). * * The widget is initialised by calling $('selector').foldable({options}). * * By default any list containing more than 10 items will be truncated after * the tenth item and a 'Show more' button displayed. * * To prevent the situation where the 'show more' button only reveals one or two * additional items, it's possible to specify the minimumReveal option, which * sets a minimum number of items that will be hidded when the list is folded. * For example, if the initial value is set to 3 and mimimumReveal set to 2, * any list with 6 or more items will be truncated after the third, if the list * contains 5 or fewer items, all items will be displayed and the foldable * widget disabled. Setting minimumReveal to 1 (the default value) treats the * 'initial' value as a hard limit. * * Example: * $('.foldable-list-class').foldable({ * child: 'li.item-class', * initial: 3, * minimumReveal: 2, * }); */ $.widget('bfi.foldable', { options: { child: 'li', // The selector to identify the child elements that are foldable initial: 10, // The initial number of items to display. minimumReveal: 1, // The minimun number of items that will be hidden/revealed, see above. withInfo: false, // Enable/disable the 'Showing x of y' text lessLabel: 'Show less', // Label for the close buttons moreLabel: 'Show more', // Label for the open buttons bottomButtonPadding: '4em', // Padding to add to the bottom of the container element to allow for the button. //callbacks toggle: null }, _create: function() { var container = this.element; var so = this.options; // Initialise a property to store the number of items currently displayed. this.currentlyShowing = 0; var minItems = so.initial + (so.minimumReveal - 1); // Count the number of child elements to ensure there are enough to trigger // the foldable widget. var count = container.find( so.child ).length; if (count > minItems) { // Add a can-fold class to all elements below the wrapper class container.find("*").addClass('can-fold'); // Find the child elements that should be shown initially. var initialSelector = (so.initial > 0) ? ':lt(' + (so.initial) + ')' : ':not(:empty)'; var initialElements = container.find(so.child + initialSelector); this.currentlyShowing = initialElements.length; // Remove the 'can-fold' class from: // - (i) the child elements that should be shown initially // - (ii) any parent elements of (i) // - (iii) any child elements of (i) // - (iv) any sibling elements that appear in the DOM immediately before // any of the elements identified above (this case handles headings // for the sections in a work's cast and credits list). initialElements.removeClass('can-fold'); initialElements.parentsUntil( container ).removeClass('can-fold'); initialElements.find("*").removeClass('can-fold'); container.find(':not(\'.can-fold\')').prev().removeClass('can-fold'); // Add the buttons and the optional "Showing x of y" text to the top and // bottom of the container element markup = (so.withInfo)? 'Showing ' + this.currentlyShowing + ' of ' + count + '. ': ''; markup = '

    ' + markup + '' + so.moreLabel + '

    '; container.prepend('
    ' + markup + '
    '); container.append('
    ' + markup + '
    '); // Bind the toggle method to the buttons. this._on( container.find('.foldable-div .btn'), { 'click': 'toggle' }); // Add additional padding to the bottom of the container element to // allow for the 'Show more' button. container.css('padding-bottom', so.bottomButtonPadding); // Run the _fold() method to set the initial state to collapsed. this._fold(); } }, toggle: function( e ) { if ($(e.target).attr('data-action')=='fold') { this._fold( $(e.target) ); } else { this._unfold( $(e.target) ); } return false; }, /** * Method to open/unfold the list. */ _unfold: function( btn ) { var container = this.element; var so = this.options; container.css('height', 'auto'); // Remove the 'folded' class from the container container.removeClass('folded'); // Show all the elements with the 'can-fold' class container.find( '.can-fold' ).show(); // Change the data-action attribute of the buttons to 'fold'. container.find('.foldable-div .btn').attr('data-action', 'fold') // Switch the label on the buttons to the 'show less' text. container.find('.foldable-div .btn').html( so.lessLabel + '' ); // Show the top button when the list is in the unfolded state. container.find('.foldable-top').show(); this.currentlyShowing = container.find( so.child + ':visible').length; if (so.withInfo) { container.find('.foldable-div span.showing').html(this.currentlyShowing); } }, /** * Method to collapse/fold the list. */ _fold: function( btn ) { var container = this.element; var so = this.options; container.find('.can-fold').hide(); container.addClass('folded'); // scroll document back to top of container element list if ( $(document).scrollTop() > container.offset().top ) { $(document).scrollTop( container.offset().top - 60 ); } // Change the data-action attribute of the buttons to 'unfold'. container.find('.foldable-div .btn').attr('data-action', 'unfold') // Switch the label on the buttons to the 'show more' text. container.find('.foldable-div .btn').html( so.moreLabel + '' ); // Update the currentlyShowing variable. this.currentlyShowing = container.find( so.child + ':visible').length; if (so.withInfo) { container.find('.foldable-div span.showing').html(this.currentlyShowing); } // Hide the top button when the list is in the folded state. container.find('.foldable-top').hide(); } }); /* --- foldable --- */ /* +++ twitter feed +++ */ $.widget('bfi.twitterFeed', { options: { delay: 0, duration: 800, speed: 2500, transition: 'easeInOutElastic' //if using transitions: "cubic-bezier(.17,.67,.84,.54)" }, _create: function(element, options) { //var so = this.options; this.reset(); }, reset: function() { var $feed = this.element; var singleColumn = true; var so = this.options; var heights = new Array(); $feed.css('height', 'auto').find('>li').each(function() { $(this).css('height', 'auto').attr('data-top', $(this).scrollTop()).attr('data-height', $(this).height()); heights.push($(this).height()); if ($feed.find('>li:first').offset().left != $(this).offset().left) singleColumn = false; }); if (singleColumn) { var height = $feed.height(); } else { var height = heights.sort().reverse()[0]; } $feed.css('height', height + 10).css('overflow', 'hidden'); if (so.verbose) console.log( 'single col: ' + singleColumn ); var count = $feed.find('>li').size(); if ($feed.hasClass('twitter-feed') && (count > 0)) { var timeout = 0, timeoutMs, transition = ''; var top = 0; $feed.find('>li').each(function() { $(this).css('position', 'relative').css('top', height).css('height', (singleColumn)? $(this).attr('data-height'): height).css('opacity', 0); var $avatar = $(this).find('span.avatar'); var $avatar_text_link = $avatar.find('>.text:not(:contains(" "))'); var avatar_text = $avatar_text_link.text(); $avatar_text_link.text(''); for (var letter in avatar_text) { $avatar_text_link.append('' + avatar_text[letter] + ''); } }); } $(window).on('scroll', $.proxy( this.animateFeed, this)); }, animateFeed: function(element) { var so = this.options; var $feed = this.element; if ( $feed.offset().top < $(window).scrollTop() + $(window).height() - 10) { var count = $feed.find('>li').size(); for (i=0; i < count; i++) { timeout = (i>0)? timeout + so.duration/2000 : 0; // + (so.duration/(i*1000)) : 0; timeoutMs = Math.floor( timeout * 1000 ); // / 1000; $feed.find('>li:eq(' + i + ')').queue( function() { var elem = this; setTimeout( function() { $.dequeue( elem )}, timeoutMs ); }).animate({ top: 0, opacity: 1 }, so.speed/* - 500*(count-i)*/, so.transition); } $(window).off('scroll', $.proxy( this.animateFeed, this)); } } }); /* --- twitter feed --- */ /* +++ responsive tables +++ */ $.widget('bfi.responsiveTable', { options: { selector: 'table.responsive', threshold: 768 }, _create: function(element, options) { var so = this.options; $(window).on("load resize update-responsive-tables", $.proxy( this.updateTables, this )); }, updateTables: function() { var self = this; var so = self.options; if ($(window).width() < so.threshold ){ $( so.selector + ':not(.switched)' ).each(function(i, element) { self.splitTable( $(element) ); $(element).addClass('switched'); }); return true; } else if ($(window).width() >= so.threshold ) { $( so.selector + '.switched').each(function(i, element) { self.unsplitTable( $(element) ); $(element).removeClass('switched'); }); } }, splitTable: function(original) { original.wrap("
    "); var copy = original.clone(); copy.find("td:not(:first-child), th:not(:first-child)").css("display", "none"); copy.removeClass("responsive"); original.closest(".table-wrapper").append(copy); copy.wrap("
    "); original.wrap("
    "); // hide information icon and expanded award description rows from // funding awards result page $('.information-icon').hide(); $('.awardDescription').hide(); }, unsplitTable: function(original) { original.closest(".table-wrapper").find(".pinned").remove(); original.unwrap(); original.unwrap(); // show information icon in funding awards results page $('.information-icon').show(); } }); /* --- responsive table --- */ /* +++ gallery +++ */ $.widget('bfi.gallery', { options: { delay: 0, transition: 5000, auto: true, stopAfterInteraction: true, perPage: 7, ratio: 4/3, imagesDir: '/sites/all/themes/bfi2013/images/', currentItem: 0, currentPage: 0, currentCategory: 0, //callbacks toggle: null }, _create: function(element, options) { var so = this.options; this.element.show(); this.element.wrap('
    '); var $element = this.element; $element.find('> li').addClass('bfig-category'); var $wrapper = $element.parent('.bfig'); $wrapper.append('
    '); //$wrapper.append('
    '); $element.find('> li').addClass('bfig-category'); var catIndex = 0; var pageSize = (so.perPage == 'auto')? floor( $element.innerWidth() / $element.find('.slide-thumbnail:first').innerWidth()) : so.perPage; $element.find('> .bfig-category > ul').each( function() { var slideCount = $(this).find(" > li").length; $(this).addClass('bfig-slides').css('height', ($element.innerWidth() / so.ratio) + 'px').css('width', (slideCount * 100) + '%'); if ( slideCount > 0 ) { $(this).parent().append('
      '); catIndex++; var $thumbnails = $(this).parent().find('.thumbnails'), pageIndex = 0, itemIndex = 0, inPage = 0; $(this).find(' > li').each( function() { $slide = $(this); $slide.addClass('slide').css('width', (100 / slideCount) + '%'); itemIndex++; inPage = (inPage + 1) % pageSize; if (inPage == 0) { $slide.addClass('last-in-page'); } if (inPage == 1) { $slide.addClass('first-in-page'); pageIndex++; $thumbnails.append('
    • '); } var thumb = $(this).find('.slide-thumbnail').remove(); if (thumb.length > 0) { $thumbnails.find('> li:last').append( '
      ' + thumb.get(0).outerHTML + '
      '); } var thumbPageCount = $thumbnails.find('> li.page').size(); $thumbnails.css('width', (thumbPageCount * 100) + '%'); $thumbnails.find('> li.page').each( function() { $(this).css('width', (100/thumbPageCount) + '%').css('left', (Math.round($(this).index()*100000/thumbPageCount)/1000) + '%') }); }); } else { $(this).find('.slide-thumbnail').remove(); } }); var thumbWidth = Math.floor(10000/(so.perPage))/100; $element.find(' > .bfig-category > .thumb-div').each(function() { $thumbDiv = $(this); if ($(this).find('> .thumbnails > li.page').length > 1) { $(this).css('padding', '0 ' + thumbWidth/2 + '%'); $(this).append('
      '); $(this).append('
      '); } else { $(this).css('padding-right', thumbWidth + '%'); } $thumbDiv.find('> .thumbnails > .page > a').width( thumbWidth + '%'); $thumbDiv.height( $element.width()/(1.05*(so.perPage+1)) ); }); $wrapper.on('click', '> .arrow-right', $.proxy( this.nextInOrder, this ) ); $wrapper.on('click', '> .arrow-left', $.proxy( this.prevInOrder, this ) ); $wrapper.on('click', '.thumb-div > .arrow-right', $.proxy( this.nextPage, this ) ); $wrapper.on('click', '.thumb-div > .arrow-left', $.proxy( this.prevPage, this ) ); $wrapper.on('click', '.thumbnails a', $.proxy( this.switchItem, this ) ); // If there's more than one category in the media panel then show the category select options. if ($('#bfi-gallery').children().length > 1) { $wrapper.append('